package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.check.businesspartition;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.check.businesspartition.BusinessPartitionService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 分区控制器
 */
@Action
@RequestMapping(value="check/businessPartition")
public class BusinessPartitionController extends BaseController {
    @Resource
    public BusinessPartitionService businessPartitionService;

    /**
     * 分区列表
     * @param  businessId	单位id：如果是机构用户登录需要传,如果是单位用户自己取
     * @return
     */
    @At(value = "businessPartitionList", method = RequestMethod.GET)
    public RespEntity businessPartitionList(@RequestBody(required = false) JSONObject jsonParam) {
        return businessPartitionService.businessPartitionList(jsonParam);
    }

    /**
     * 分区详情
     * @param  id	分区的id
     * @return
     */
    @At(value = "businessPartitionDetail", method = RequestMethod.GET, param = { "id"})
    public RespEntity businessPartitionDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return businessPartitionService.businessPartitionDetail(jsonParam);
    }

    /**
     * 分区新增
     * @param  name	姓名
     * @return
     */
    @At(value = "businessPartitionAdd", method = RequestMethod.POST, param = { "name" })
    public RespEntity businessPartitionAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return businessPartitionService.businessPartitionAdd(jsonParam);
    }

    /**
     * 分区修改
     * @param
     * name	姓名
     * id	分区id
     * @return
     */
    @At(value = "businessPartitionUpdate", method = RequestMethod.POST, param = { "name","id" })
    public RespEntity businessPartitionUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return businessPartitionService.businessPartitionUpdate(jsonParam);
    }

    /**
     * 分区删除
     * @param   id	分区的id
     * @return
     */
    @At(value = "businessPartitionDelete", method = RequestMethod.POST, param = { "id" })
    public RespEntity businessPartitionDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return businessPartitionService.businessPartitionDelete(jsonParam);
    }






   
}